home *** CD-ROM | disk | FTP | other *** search
- import com.siemens.mp.game.Melody;
- import com.siemens.mp.game.MelodyComposer;
- import java.io.InputStream;
-
- public class Sounds {
- static boolean reset;
- private static Melody[] mel;
- private static final int[] tempos = new int[]{200, 200, 200, 200, 200, 200, 140, 120, 140};
- private static final int[][][] melodies = new int[][][]{{{36, 4}, {40, 4}, {43, 3}, {48, 4}, {50, 4}, {52, 3}}, {{36, 4}, {40, 4}, {48, 4}}, {{36, 5}}, {{43, 5}, {52, 5}}, {{45, 5}, {33, 4}}, {{40, 5}, {40, 5}, {58, 5}, {36, 4}}, {{36, 3}, {35, 3}, {33, 3}, {31, 3}, {45, 3}, {21, 3}, {28, 3}, {24, 3}, {12, 3}, {26, 3}, {28, 3}, {29, 3}, {26, 3}, {32, 3}, {33, 3}, {36, 2}, {35, 3}, {28, 2}, {26, 3}, {24, 3}, {23, 3}, {21, 2}, {20, 2}, {21, 2}}, {{36, 5}, {58, 5}, {40, 5}, {40, 5}, {48, 4}}, {{34, 4}, {17, 4}, {34, 3}, {29, 4}, {30, 4}, {31, 2}, {17, 3}, {29, 3}, {27, 3}, {26, 4}, {19, 4}, {26, 4}, {27, 4}, {26, 3}, {24, 2}, {12, 2}}};
-
- private static byte[] readFile(String var0, int var1) {
- byte[] var2 = new byte[var1];
-
- try {
- InputStream var3 = var0.getClass().getResourceAsStream(var0);
- var3.read(var2);
- var3.close();
- return var2;
- } catch (Exception var4) {
- return null;
- }
- }
-
- public static void play(int var0) {
- if (Runko.SoundOn) {
- try {
- if (mel == null) {
- init();
- }
-
- mel[var0].play();
- } catch (Exception var2) {
- System.out.println(var2);
- }
- }
-
- }
-
- public static void init() {
- mel = new Melody[9];
- MelodyComposer var0 = new MelodyComposer();
-
- for(int var1 = 0; var1 < mel.length; ++var1) {
- var0.resetMelody();
- int[][] var2 = melodies[var1];
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- try {
- var0.appendNote(var2[var3][0], var2[var3][1]);
- } catch (Exception var5) {
- }
- }
-
- var0.setBPM(tempos[var1]);
- mel[var1] = var0.getMelody();
- }
-
- }
- }
-